Repository navigation
Run: show every check before the first image read, and make the header check linear (v0.9.0 release blocker) - #567
Conversation
On a large mixed-layout experiment in Colab, Run showed "Preparing: checking the folders and the image headers again 0:00 elapsed" for 10-15 minutes. The run checks the folder and every image header again before its first image (preflight with bind_headers), with no progress reported, and the notebook's Wait redraws its elapsed time only on a progress report. Not a deadlock and not new in v0.9.0: the same at ad8abad. - RunMode(checking=...) passes preflight's (phase, done, total, path) progress through the run (operational only, like workers; the parameters of run_experiment are unchanged). - The notebook shows each phase and each header of how many, and Wait.ticking() redraws the elapsed time every second in a thread while the run works, stopped before the result replaces the line. While the run goes, a note says a cell run meanwhile waits for it. - Two O(n^2) steps of the check: each staging key took MetadataReport.dtype (a pass over every header), and the mask-name screen compared each image name with every other one. Outputs byte-identical on a 4,800-image tree; the check before the first image went from 30.0 s to 10.3 s (12,000 images) and 72-75 s to 24-27 s (24,000 images) on local disk. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a
…move PREPARING and BUSY_NOTE live with the Wait they label, in notebook_progress.py; the full check had failed only on the line count. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a
CHANGELOG.md: both Unreleased entries kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a
… first image The owner's run (about 200 images on Google Drive) spent 10-15 minutes before the first read. Measured on 784 MB of TIFFs: before the first read, a verify_content run (the notebook's default, and any fresh output folder) reads every image whole once (1.00x the data) for its content SHA-256, in source_content.with_content, with no progress. The header check reads only headers (0.00x). Each image is opened 4 times before the first read (header, projection marker, check_planes, SHA-256). with_content now reports each image hashed; the run passes it to RunMode.checking as the phase "contents" (run.phases.CONTENTS), and the notebook shows "Preparing: reading each image whole for its content SHA-256 · n of N". compute_rows takes a Reporting (reading, checking) instead of the progress callable, keeping its 8 parameters. What is read and verified is unchanged; outputs are byte-identical. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a
|
New head:
Where the owner's 10–15 minutes go (about 200 images, Google Drive)Method. 6 uncompressed TIFFs, 98–147 MB each (784 MB total), with mixed layouts. I ran the notebook's default run (
Cause. Before the first read, the only whole-file read is the content SHA-256 that What Reductions that change what is verified (owner decisions, not implemented)
🤖 Generated with Claude Code Generated by Claude Code |
…lock Review of f0986a3 (low findings): - preflight's placeholders ("masks", 0, 1, "") made a run without masks show "0 of 1": a phase now starts counted only from the headers' start or a call with a path, and an end without a path is drawn only when the phase counted that total; - the headers (and the content SHA-256 pass) now end at "N of N"; - Wait.start/phase set the label and clocks under the drawing lock, so the ticking thread never draws a new label with the old numbers; - the test's copy of the old _mask_owner rule takes the folder with PurePosixPath, as the code did, and the random names include top-level images. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a
One conflict, in CHANGELOG.md: both sides added entries at the top of the v0.9.0 list (the #543 and #544 entries here; the #567 and #566 entries on main). Both kept. The notebooks' RELEASE_REF, the RELEASE_CALLS entry and the pin assertion are put back to their pre-pin values (the branch carried commit B's pins) so that commit B moves them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a
The full python tools/check.py on the tree of the merge commit 86d7674 (main at 316be56 with #566 and #567 on top of the earlier v0.9.0 PRs): Ruff clean, 761 files formatted, pytest 8832 passed and 12 skipped, code rules passed; the Spec modules 2122 passed, 0 skipped; the notebook pin and version tests 49 passed. Docs only: this commit is the v0.9.0 preparation commit A that commit B pins. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a
Run progress: masks counter reaches N of N; stray docstring (follow-up of #567)
Head:
7aa55ee(origin/main88a1c42merged in). The review off0986a3is out of date.What the owner saw (Colab, v0.9.0 release commit B ca3b3c6 / A 62b2790)
The owner pressed Run on about 200 images on Google Drive, with mixed channel layouts and a fresh output folder. The notebook showed "Preparing: checking the folders and the image headers again · 0:00 elapsed" and nothing changed for 10–15 minutes. The run then finished. Re-running the cell during that time just waited.
Root cause
This is not a deadlock, and it is not new in v0.9.0:
ad8abadbehaves the same (12,000 images: 24.2 s there against 27.4 s at A, on local disk).run/pipeline.py_locked_run→preflight(bind_headers=True),run_checks/check_planes, thencompute_rows→source_content.with_content) report nothing.Waitredraws, elapsed time included, only when progress is reported, and the run executes synchronously in the button callback.verify_contentrun (the notebook's default, and any fresh output folder, Content hashing of sources is off by default #159), the run reads every image whole for its SHA-256 before the first pixel. The header check itself reads only headers. See the measurements below.run/resume.py_staging_keycomputedMetadataReport.dtype, a pass over every header, once per image.mask_names._mask_ownercompared each image name with every other one. These matter for large experiments, not for 200 images.finally.Bytes read and opens per image (784 MB of TIFFs, notebook-default run, fresh output folder)
Measured with
/proc/self/iorchar at phase boundaries andstracefor opens:preflight,bind_headers)check_planeswith_content)content_changed)On Drive, the time before the first read is about one whole read per image plus 4 opens. At 200 images, 3–4.5 s per image fits files of roughly 100–300 MB. Check (step 1) never hashes content, so nothing is hashed twice between Check and Run. Within one Run, each image is read whole 4 times.
I did not simulate slow storage: there is no FUSE in this container, and a Python-level read throttle undercounts tifffile's reads. The estimate above is a model from the measured counts.
Fix
RunMode(checking=...)passes progress out of the run. It is called with preflight's(phase, done, total, path), then with the phasecontents(run.phases.CONTENTS) once per image hashed. It is operational only, likeworkers.run_experimentkeeps its 14 parameters.compute_rowstakes aReporting(reading, checking)and keeps its 8 parameters.("masks", 0, 1, "")with no masks) no longer show "0 of 1".Wait.ticking()redraws the elapsed time every second from a thread. The label, clocks and line change together under one lock, and the thread is joined before the result replaces the line._mask_ownerlooks up the prefixes of the name; a test checks it against the old rule on 400 random names, including top-level images.Benchmarks (local disk)
Header check, time to the first read callback (2 conditions × 4 repeats × 3 units, 3- and 2-channel repeats):
Identical outputs:
f0986a3:plane_histograms.csv,experiment_design.csvandimage_qc.csvbyte-identical (sha256 prefixes 1da6b3d989aa0dfe, 78503fbfa325f65d, dc6edcdac4c3b598).88a1c42vsd9bf371(before the review fixes in7aa55ee): the same three files byte-identical (bd7914d2f396e5f4, a7a786acae4651d0, 3a412ac41cdec812).Reductions that need the owner (not implemented: each one changes what is verified, or the reader)
verify_contentoff by default on a fresh output folder or on Drive. Saves 3× data. Reuse would go by size + mtime_ns only, so a rewrite of the same size with its time set back would not be seen.check_planes. Saves 2 opens per image, headers only, bound to the same fingerprint. This is engineering-only, not trivial, and left for later.Tests
tests/test_run_checking_progress.py(12 tests) covers:_mask_ownerlooks names up instead of scanning every image, and matches the old rule;Waitredraws its elapsed time, stops with its block and does not overwrite the result;Most of these fail on main.
test_brick_api_surfaceis updated for the newRunModefield.Checks on
7aa55eepython tools/check.py(under the shared lock): Ruff clean, 761 files formatted, 8735 passed, 20 skipped, code rules passed. The 20 skips are optional backends that are not installed here (e.g. scikit-image).🤖 Generated with Claude Code
https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a